/* vue router 路由模块 */
// 导入需要的组件 
import Vue from 'vue'
import VueRouter from 'vue-router'

// 导入组件
import Miste from '@/pages/Miste/Miste'
import Search from '@/pages/Search/Search'
import Order from '@/pages/Order/Order'
import Profile from '@/pages/Profile/Profile'
import Login from '@/pages/Login/Login'

// 导入商家相关组件
import Shop from '@/pages/Shop/Shop' 
// 这个应该不需要注册为路由吧 , 这个东西在路由上不进行显示
// import ShopHeader from '@/pages/Shop/ShopHeader/ShopHeader' 
import ShopGoods from '@/pages/Shop/ShopGoods/ShopGoods' 
import ShopInfo from '@/pages/Shop/ShopInfo/ShopInfo'
import ShopRatings from '@/pages/Shop/ShopRatings/ShopRatings' 


// 使用插件

Vue.use(VueRouter)

// 导出路由对象

export default new VueRouter({
    routes: [
        // 底部导航
        {
            path: '/miste',
            component: Miste,
            meta: {
                showFooter: true
            }
        },
        {
            path: '/search',
            component: Search,
            meta: {
                showFooter: true
            }
        },
        {
            path: '/order',
            component: Order,
            meta: {
                showFooter: true
            }
        },
        {
            path: '/profile',
            component: Profile,
            meta: {
                showFooter: true
            }
        },
        // 登录
        {
            path: '/login',
            component: Login
        },
        // 商家组件路由
        {
            path: '/shop',
            component: Shop,
            // 这里不需要显示底部的导航 , 所以将这个注释掉
            // meta: {
            //     showFooter: true
            // }
            // 子路由 
            children: [
                {
                    path: '/shop/goods',
                    component: ShopGoods
                },
                {
                    path: '/shop/ratings',
                    component: ShopRatings
                },
                {
                    path: '/shop/info',
                    component: ShopInfo
                },
                // 默认打开路由
                {
                    path: '/shop',
                    redirect: '/shop/goods'
                },
            ]
        },
        // 配置默认显示的组件
        {
            path: '/',
            redirect: '/miste'
        },
    ]
})